<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Form Test</title>
<link rel="stylesheet" href="../css/form5.css" type="text/css" />
<link rel="stylesheet" href="../../modules/system/gfx/bootstrap/css/bootstrap.css" type="text/css" />


<script type="text/javascript" src="../liwe.js"></script>
<script type="text/javascript" src="../ajax_manager.js"></script>
<script type="text/javascript" src="../locale.js"></script>
<script type="text/javascript" src="../utils.js"></script>
<script type="text/javascript" src="../string_enh.js"></script>
<script type="text/javascript" src="../types.js"></script>
<script type="text/javascript" src="../form5.js"></script>
<script type="text/javascript" src="../form5.bootstrap.js"></script>
<script type="text/javascript" src="../dom.js"></script>
<script type="text/javascript" src="../validators.js"></script>
<script type="text/javascript" src="../event_manager.js"></script>

<script type="text/javascript">
var tpl = "%(form-start)s %(hello-label)s: %(hello)s %(send)s %(form-end)s";


function create_form ()
{
	liwe._libbase = "../";
	
	var f = new liwe.form5.instance ( 'test', { "class" : "form-horizontal" } );

	f.url = "http://localhost:8000/test.pyhp";

	f.set_groups ( [
		{ label: "Gruppo 1", name: "grp1" },
		{ label: "Gruppetto 2", name: "grp2" }
	] );

	f.add ( 'text',     'login', { label: "login:", mandatory: true, accesskey: 'l', size: 30, maxlength: 50, placeholder: "Insert login here", filter: "abcdefg", group: "grp1", disabled: true } );
	f.add ( 'password', 'pass',  { label: "Password:", mandatory: true, accesskey: 'p', size: 30, maxlength: 50, group: "grp1" } );
	f.add ( 'email',    'email', { label: "E-Mail:", mandatory: true, accesskey: 'e', size: 30, maxlength: 50, group: "grp2" } );

	f.add ( 'cod_fisc',    'cod_fisc', { label: "Codice Fiscale", group: "grp2" } );
	f.add ( 'p_iva',    'p_iva', { label: "Partita IVA", group: "grp2" } );
	
	f.add ( 'submit', "submit", { value: "Invia", group: "grp2", nonl: 1 } );
	f.add ( 'reset',  "reset", { value: "Reset", group: "grp2" } );
s
	f.set ( 'my_form' );

	f.addEventListener ( "submit", function ( evt ) { return confirm ( "submit" ); } );
	f.addEventListener ( "reset",  function ( evt ) { return confirm ( "Resetto la form?" ); } );

	
	f = new liwe.form5.instance ( "test-tpl" );

	f.add ( "text", "hello", { label: "Hello", mandatory: true } );
	f.add ( "submit", "send", { label: "Invia" } );

	f.set ( "form-tpl", tpl );
}
</script>
</head> 
<body onload="create_form()">

<h2>Form 1</h2>
<div style="padding: 2em;">
<div id="my_form"></div>


<div id="form-tpl"></div>

</div>



</body>
</html>
